Jump to content

Weird Problem With Swfobject.js Script


Krissi

Recommended Posts

On my main site (http://snuppa.krissi.net) I'm using the script swfobject.js in order to show the flash in the header. The version of the swfobject.js file is v1.5.

 

Then the creator of the flash upgraded and included the new version of swfobject.js (http://code.google.com/p/swfobject/) which is v2.1.

 

I tested this on my test site: http://test.krissi.net - but whatever I do - I'm not able to get the script declared and working, so that the flash would work. I've discussed this with several others using the same script/flash and they made it work with the new code, but one of them had to contact the host provider in order to change some security settings on the script. I made a ticket into the help desk ( HKY-165224 ), but they claim there is no such issues with the script.

So - is there anyone out there who have any knowledge of this that can help me out? Why will not the script be declared and "loaded" at all? I'm calling the script in the header section along with the other scripts the site is using (on the test site: http://test.krissi.net).

 

Any help will be highly appreciated!

 

Thanks!

 

Krissi

Edited by Krissi
Link to comment
Share on other sites

I thought swfObject 2.1 didn't use the same syntax as before.

 

you are using:

 

>var so = new SWFObject("http://test.krissi.net/wp-content/themes/arthemia-premium/deploy/preview.swf?xmlPath=http://test.krissi.net/wp-content/themes/arthemia-premium/deploy/accordion.xml&KeepSelected=t&selectedWindow=0&imageWidth=420&imageHeight=325&sWidth=600&sHeight=325", "sotester", "600", "325", "8", "#ffffff");
					so.addParam("allowFullScreen", "true");
					so.addParam("wmode", "transparent");
					so.write("flashcontent");

 

 

I thought the new version made use of this syntax to embed a swf:

 

 

>swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes);

 

where 'id' is the id of the DOM element you are trying to embed the swf into.

 

 

But then again I am no javascript expert so I might be wrong.

Edited by OJB
Link to comment
Share on other sites

Thanks for the nice welcome! :)

And to TCH-Ellis for looking into the error messages.

 

OJB; I'm a total novise when it comes to this, all I've done is using a code and implementation that others have used. And they have the same wordpress version and theme. The sample html file that came with the accordian flash is in fact working fine on my site: http://test.krissi.net/wp-content/themes/a...premium/deploy/ - but this is how it is called in a html-file. I'm (of course) using php-files in Wordpress. It might be that I need to declare the script in another manner because of the new version, but I'm lost on how. I can read your line of code, OJB, but I do not know enough to find out how to implement it.

 

Now comes the really weird stuff. Another Wordpress installation, with the same theme has implemented the script in the new version and the got the flash to work, with the exact same code that I have used: http://tatianamoses.com/blog/ She's the one who made it work after contacting the site host provider and they made some changes (white listed the script, I think).

 

So the script in the new version is possible to implement in a php page (in wordpress) using the code I have done.

 

Krissi

Link to comment
Share on other sites

you need to create a div with a unique id where the SWF is going to be embedded.

 

then somewhere OUTSIDE of that div you need to put the following:

 

><script type="text/javascript">
	
		var stageW = 650;
		var stageH = 300; 
		var cacheBuster = Date.parse(new Date());
		
		var flashvars = {};
		var params = {};
		
		params.bgcolor = "#efefef";
		params.allowfullscreen = "true";
		
		
		flashvars.stageW = stageW;
		flashvars.stageH = stageH;
		
		flashvars.xmlPath = "accordion.xml";

		flashvars.keepSelected = "t";
		flashvars.selectedWindow = "4";
		flashvars.slideshow = "t";
		
		flashvars.imageWidth = "315";
		flashvars.imageHeight = "300";
		
		swfobject.embedSWF("preview.swf?t="+cacheBuster, "YOURDIVID", stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params);
		
	</script>

 

Note where it says "YOURDIVID", you replace that with the id you have given the div you want to embed the swf into.

 

so for a very basic example

 

><html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
	
		var stageW = 650;
		var stageH = 300; 
		var cacheBuster = Date.parse(new Date());
		
		var flashvars = {};
		var params = {};
		
		params.bgcolor = "#efefef";
		params.allowfullscreen = "true";
		
		
		flashvars.stageW = stageW;
		flashvars.stageH = stageH;
		
		flashvars.xmlPath = "accordion.xml";

		flashvars.keepSelected = "t";
		flashvars.selectedWindow = "4";
		flashvars.slideshow = "t";
		
		flashvars.imageWidth = "315";
		flashvars.imageHeight = "300";
		
		swfobject.embedSWF("preview.swf?t="+cacheBuster, "flashAccordion", stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params);
		
	</script>

</head>
<body>
<div id="flashAccordion">
</div>
</body>
</html>

Link to comment
Share on other sites

OMG! :P

 

OJB, you made it! You actually managed to help me out on this! I had to include the full path to the files (accordian.xml, preview.swf etc), but then the flash finally showed up!!!!

 

I need to do some tweaking on the size etc, but that's just minor stuff.

 

You can't image how many hours I've been struggling with this, and here you came like Superman (or Superwoman?) and just saved my day! I'm so grateful!!

 

Thanks, thanks and thanks!! :) :)

Link to comment
Share on other sites

My Superman! :)

 

I do have one more issue, but I guess it's a long shot. Do you know anything about national characters in Flash scripts like these?

I'm Norwegian, and we do have some odd characters. I tried to get help from the creator of the Flash and all he said was:

 

Guys, in order to add support for these characters, you need to embed all chars of the fonts used in Flash. Simply select the font and choose embed all. I didn’t do that because it would make the file much larger and most of the buyers don’t need all the 54k+ chars embedded into the swf.

 

Can this be done in the code?

Link to comment
Share on other sites

That's too much money to spend for changing the Flash, it's not like I'm a Flash developer. :)

Maybe I can get the developer to do the embedding in the code for me, for a smaller amount.

 

Thanks again, OJB. I've come far with your help! :D

Link to comment
Share on other sites

I just wanted to conclude the issue on national characters, in case any other have the same issue. In my case, I had an xml-file that provide the text into the Flash. By saving the xml-file with the utf-16 encoding, I was able to use national characters in the Flash.

 

Krissi

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...